package com.iris.live.services.common;

import java.util.Random;

/**
 * 生成密码工具类
 * @author: wangzhenyan
 * date: 2017/9/25 12:09
 */
public class PwdUtils {

    public static final String pwdStr = "23456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";  // 密码字符集(去掉了易混的字符)

    public static String generatePwd() {
        return generatePwd(6,pwdStr);
    }

    public static String generatePwd(int pwdSize,String source) {
        StringBuffer password = new StringBuffer();
        Random random = new Random();
        for (int i=0; i<pwdSize; i++) {
            password.append(source.charAt(random.nextInt(source.length())));
        }
        return password.toString();
    }

   public static void main(String[] args) {
       System.out.println(generatePwd());
   }


}
